package com.gitee.wsl.struct.category


import com.gitee.wsl.struct.tree.MutableNodeElement


open class CategoryItemWarp(item: Any) : MutableNodeElement<Any>(item) {

    open var categoryItemType:Int = 0

    val item:Any get() = data


    fun addSubCategoryItem(subItem: CategoryItemWarp) {
        add(subItem)
    }

    fun addSubCategoryItems(subItems: List<CategoryItemWarp>) {
        for (item in subItems) addSubCategoryItem(item)
    }

    val subItemList: List<CategoryItemWarp>
        get() = children
            .map { item -> item as CategoryItemWarp }
            /*.collect(
                Collectors.toList()
            )*/

    fun clearSubItemList() {
        super.clear()
    }

    open fun title(): String {
        return ""
    }

    companion object {
        const val CATEGORY_ITEM_TYPE_FILE = 279432131
    }
}